import { Controller } from 'egg';

export default class CategoriesController extends Controller {
  public async index() {
    const { ctx } = this;
    const categories = await ctx.service.categories.get();
    ctx.body = {
      code: 0,
      message: '成功',
      result: {
        categories
      },
    };
  }
  public async statistics() {
    const { ctx } = this;
    const category_statistics = await ctx.service.categories.get(undefined,undefined,true);
    ctx.body = {
      code: 0,
      message: '成功',
      result: {
        category_statistics
      },
    };
  }
}
